def checkID(id):
    lenth=len(id)
    if lenth>8 or lenth == 0:
        return False
    else:
        if not id.replace("_","x").isalnum():
            return False
    
    return True


def checkEmail(email):
    
    atIndex=email.find("@")
    dianIndex=email.find(".")
    if atIndex==-1 or dianIndex == -1:
        return False
    lenth=len(email)
    if  atIndex<dianIndex and not atIndex==0 and not dianIndex+1==lenth:
        return True
    else:
        return False 


def checkIDcar(idcar):
    if not len(idcar)==18:
        return False
    else:
        if not idcar[0:-1].isdigit():
            return False
        else:
            if not( idcar[-2:-1].isdigit() or idcar[-2:-1]=="x"):
                return False
    return True


def checkName(name):
        for ch in name:
            if u'\u4e00' <= ch <= u'\u9fff':
                return True
        return False

def main():
    ID=input("请输入ID，只能包含数字，字母，下划线,长度为8\n")
    while not checkID(ID):
        ID=input("格式错误，请重新输入\n")
    email=input("请输入邮箱\n")
    while not checkEmail(email):
        email=input("格式错误，请重新输入\n")
    IDcar=input("请输入身份证号\n")
    while not checkIDcar(IDcar):
        IDcar=input("格式错误，请重新输入\n")
    name=input("请输入昵称，只能是中文\n")
    while not checkName(name):
        name=input("格式错误，请重新输入\n")
main()

